function main(params) {
    // 获取时间和当前点击的id
    debugger
    const self = this;
    let queryType = 2;
    let taskStatType = self.$$("text_input_12q0e0").cValue;

    let { startTime, endTime } = getTimeParam(taskStatType);
    let lawSubjectName = params.data.field1;
    let lawSubjectId = params.data.lawSubjectId;
    const queryParams = {
        queryType: queryType,
        startTime: startTime,
        endTime: endTime,
        lawSubjectId: lawSubjectId
    }
    let pageId = '1984514001144344576';
    let titleName = lawSubjectName + '涉企检查';

    openMobilePage(self, titleName, pageId, queryParams)

}

/**
 * 打开移动端页面
 */
function openMobilePage(self, titleName, pageId, queryParams) {
    self.$router.push({
        name: "page-preview",
        query: {
            title: titleName,
            pageId: pageId,
            queryType: queryParams.queryType,
            lawSubjectId: queryParams.lawSubjectId,
            startTime: queryParams.startTime,
            endTime: queryParams.endTime,
            showHeader: self.$route.query.showHeader,
            pageTitle: titleName,
            linkTitle: titleName,
            showBackHeader: true,
            isFromAction: 1,
            _t: new Date().getTime() + ""
        }
    });
}


function getTimeParam(taskStatType) {
    const today = new Date();
    const todayEnd = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);

    // 格式化日期为 "YYYY-MM-DD HH:mm:ss"
    const formatDate = (date) => {
        const pad = (num) => num.toString().padStart(2, '0');
        return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ` + `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
    };

    let startTime;

    switch (taskStatType) {
        case "2": // 年统计
            startTime = new Date(today.getFullYear(), 0, 1, 0, 0, 0);
            break;
        case "3": // 月统计
            startTime = new Date(today.getFullYear(), today.getMonth(), 1, 0, 0, 0);
            break;
        case "4": // 周统计
            const mondayOffset = today.getDay() === 0 ? 6 : today.getDay() - 1;
            startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate() - mondayOffset, 0, 0, 0);
            break;
        default: // 日统计
            startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
    }

    return {
        startTime: formatDate(startTime), endTime: formatDate(todayEnd)
    };
}
